package j03static;

class Cat{
    void say(){
        System.out.println("miao!");
    }
}

public class J1 {
    public static void main(String[] args) {
        f1();
    }

    //提升到类层面，不需要实例化，
    public static void f1(){
        System.out.println(1);
    }
}

class Person{
    String name;
    static String guoji;

    static void f1(){
        System.out.println("i am f1");
    }
}

class PersonTest{
    public static void main(String[] args) {
        Person.guoji = "china";
        System.out.println(Person.guoji);
//        System.out.println(Person.name);
        Person.f1();

        System.out.println(Math.sqrt(4));
        System.out.println("=====");
        Person p1 = new Person();
        p1.name = "成龙";
        Person p2 = new Person();
        p2.name = "李连杰";
        //实例也能访问static修饰的属性、方法，但是不推荐
        System.out.println(p1.guoji);
        System.out.println(p2.guoji);

        p1.f1();
    }
}